package com.coda.app.controller;

import com.coda.app.service.LeaseAgreementService;
import com.coda.app.service.LeaseTermService;
import com.coda.entity.LeaseTerm;
import com.coda.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/app/term")
@Api(tags = "租期信息")
public class LeaseTermController {

    @Autowired
    private LeaseTermService leaseTermService;

    /**
     * 根据房间id获取可选租期
     */
    @GetMapping("listByRoomId")
    @ApiOperation("根据房间id获取可选租期")
    public Result<List<LeaseTerm>> getTermList(@RequestParam Long id){
        List<LeaseTerm> leaseTermList = leaseTermService.getTermList(id);
        return Result.ok(leaseTermList);
    }
}
